using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using System.IO;

namespace RetailAnalytic.Adhook.PivotTable.Engine
{
    public partial class UCMain : UserControl
    {
        public UCMain()
        {
            InitializeComponent();
            SetGuiAppearance();
        }
        private void SetGuiAppearance()
        {
            this.btn_browse.Appearance.Image = SR.ImagesLibrary.GetImageByName("open");
            this.cb_pvt.Appearance.Image = SR.ImagesLibrary.GetImageByName("adhook1");
            this.cb_cs.Appearance.Image = SR.ImagesLibrary.GetImageByName("town");
            this.cb_cs1.Appearance.Image = SR.ImagesLibrary.GetImageByName("town");
            this.cb_wb.Appearance.Image = SR.ImagesLibrary.GetImageByName("RS_16");
        }
        private void btn_browse_Click(object sender, EventArgs e)
        {
        }
        private void ultraButton1_Click(object sender, EventArgs e)
        {
            OpenFileDialog fd = new OpenFileDialog();
            fd.Filter = "xip file|*.xip";
            DialogResult dr = fd.ShowDialog();
            
            if (dr == DialogResult.OK)
            {
                if (File.Exists(fd.FileName))
                {
                    tbFile.Text = fd.FileName;
                }
            }
        }
        private void ultraCheckEditor1_CheckedChanged(object sender, EventArgs e)
        {
            tbFile.Enabled = cb_fromFile.Checked;
            btn_browse.Enabled = cb_fromFile.Checked;
            try
            {
                if (ParentForm.GetType().Name == "FrmNP")
                {
                    ((FrmNP)ParentForm).FrmNP_Validated(this, EventArgs.Empty);
                }
            }
            catch { }

        }
        private void cb_pvt_CheckedChanged(object sender, EventArgs e)
        {
        }
        private void ucBind_CheckedChanged(object sender, EventArgs e)
        {
            if (ucBind.Checked)
            {
                cb_pvt.Checked = true;
                cb_cs.Checked = true;
            }
        }

        private void ute_name_ValueChanged(object sender, EventArgs e)
        {
            try
            {
                if (ParentForm.GetType().Name == "FrmNP")
                {
                    ((FrmNP)ParentForm).FrmNP_Validated(this, EventArgs.Empty);
                }
            }
            catch { }
        }
    }
}
